package net.zozoo.ioc.di2;

import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestEmp {
    @Test
    public void testEmp() {
        ApplicationContext context = new ClassPathXmlApplicationContext("emp-di.xml");
        Emp emp = (Emp) context.getBean("emp");
        emp.work();
    }

    @Test
    public void testEmp2() {
        ApplicationContext context = new ClassPathXmlApplicationContext("emp-di.xml");
        Emp emp = (Emp) context.getBean("emp2");
        emp.work();
    }

    @Test
    public void testEmp3() {
        ApplicationContext context = new ClassPathXmlApplicationContext("emp-di.xml");
        Emp emp = (Emp) context.getBean("emp3");
        emp.work();
    }


    @Test
    public void testEmp4() {
        //测试注入数组
        ApplicationContext context = new ClassPathXmlApplicationContext("emp-di-arr.xml");
        Emp emp = (Emp) context.getBean("emp");
        System.out.println(emp);
    }

}
